package org.oyrm.kobo.formBuilder.ui;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JToolBar;

import org.oyrm.kobo.formBuilder.settings.Settings;

/**
 * The main tool bar for the Form Builder
 * @author etherton
 *
 */
public class QuestionsToolBar extends JToolBar {
	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -2806750120793510391L;

	/**
	 * Open a select option button
	 */
	private JButton addSelectBtn = null;
	
	/**
	 * delete a question
	 */
	private JButton deleteBtn = null;
	
	/**
	 * JButtons for each question type
	 */
	private JButton textQstBtn = null;
	private JButton integerQstBtn = null;
	private JButton decimalQstBtn = null;
	private JButton dateQstBtn = null;
	private JButton multiSelectQstBtn = null;
	private JButton singleSelectQstBtn = null;
	private JButton timeQstBtn = null;
	private JButton dateTimeQstBtn = null;
	private JButton pictureQstBtn = null;
	private JButton videoQstBtn = null;
	private JButton audioQstBtn = null;
	private JButton gpsQstBtn = null;
	private JButton barcodeQstBtn = null;
	private JButton labelQstBtn = null;
	private JButton repeatQstBtn = null;
	private JButton groupQstBtn = null;
	
	

	
	
	public QuestionsToolBar()
	{
		super();
		createComponents();
		placeComponents();
	}

	private void createComponents() {
		
		setAlignmentX(0);
		ImageIcon tempIcon;
		


		tempIcon = new ImageIcon(getClass().getResource("/resources/addChild.png"));
		addSelectBtn = new JButton(tempIcon);
		addSelectBtn.setToolTipText(Settings.getI18n().getString("AddSelectOptionText"));
		
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/delete.gif"));
		deleteBtn = new JButton(tempIcon);
		deleteBtn.setToolTipText(Settings.getI18n().getString("DeleteQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addText.png"));
		textQstBtn = new JButton(tempIcon);
		textQstBtn.setToolTipText(Settings.getI18n().getString("TextQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addNumeric.png"));
		integerQstBtn = new JButton(tempIcon);
		integerQstBtn.setToolTipText(Settings.getI18n().getString("IntegerQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addDecimal.png"));
		decimalQstBtn = new JButton(tempIcon);
		decimalQstBtn.setToolTipText(Settings.getI18n().getString("DecimalQuestionText"));		
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addDate.png"));
		dateQstBtn = new JButton(tempIcon);
		dateQstBtn.setToolTipText(Settings.getI18n().getString("DateQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addMultSelect.png"));
		multiSelectQstBtn = new JButton(tempIcon);
		multiSelectQstBtn.setToolTipText(Settings.getI18n().getString("MultiSelectQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addSingSelect.png"));
		singleSelectQstBtn = new JButton(tempIcon);
		singleSelectQstBtn.setToolTipText(Settings.getI18n().getString("SingleSelectQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addTime.png"));
		timeQstBtn = new JButton(tempIcon);
		timeQstBtn.setToolTipText(Settings.getI18n().getString("TimeQuestionText"));		
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addDateTime.png"));
		dateTimeQstBtn = new JButton(tempIcon);
		dateTimeQstBtn.setToolTipText(Settings.getI18n().getString("DateTimeQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addPicture.png"));
		pictureQstBtn = new JButton(tempIcon);
		pictureQstBtn.setToolTipText(Settings.getI18n().getString("PictureQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addVideo.png"));
		videoQstBtn = new JButton(tempIcon);
		videoQstBtn.setToolTipText(Settings.getI18n().getString("VideoQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addAudio.png"));
		audioQstBtn = new JButton(tempIcon);
		audioQstBtn.setToolTipText(Settings.getI18n().getString("AudioQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addGPS.png"));
		gpsQstBtn = new JButton(tempIcon);
		gpsQstBtn.setToolTipText(Settings.getI18n().getString("GpsQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addBarcode.png"));
		barcodeQstBtn = new JButton(tempIcon);
		barcodeQstBtn.setToolTipText(Settings.getI18n().getString("BarcodeQuestionText"));

		tempIcon = new ImageIcon(getClass().getResource("/resources/addLabel.png"));
		labelQstBtn = new JButton(tempIcon);
		labelQstBtn.setToolTipText(Settings.getI18n().getString("LabelQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addRepeat.png"));
		repeatQstBtn = new JButton(tempIcon);
		repeatQstBtn.setToolTipText(Settings.getI18n().getString("RepeatQuestionText"));
		
		tempIcon = new ImageIcon(getClass().getResource("/resources/addGroup.png"));
		groupQstBtn = new JButton(tempIcon);
		groupQstBtn.setToolTipText(Settings.getI18n().getString("GroupQuestionText"));
		
	}

	private void placeComponents() {

		this.add(textQstBtn);
		this.add(integerQstBtn);
		this.add(decimalQstBtn);
		this.add(dateQstBtn);
		this.add(multiSelectQstBtn);
		this.add(singleSelectQstBtn);
		this.add(timeQstBtn);
		this.add(dateTimeQstBtn);
		this.add(pictureQstBtn);
		this.add(videoQstBtn);
		this.add(audioQstBtn);
		this.add(gpsQstBtn);
		this.add(barcodeQstBtn);
		this.add(labelQstBtn);
		this.add(repeatQstBtn);
		this.add(groupQstBtn);
		
		this.add(deleteBtn);
		this.add(addSelectBtn);
		
	}

}
